{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c87093d7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用户输入方法: input()\n",
    "# 回顾上节内容: 登录系统（while循环、input输入）\n",
    "# 本节：打印(print)输出的一般方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0e0f0570",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name: xinyi\n",
      "age: 20\n",
      "job: dd\n",
      "salary: 200\n"
     ]
    }
   ],
   "source": [
    "name = input(\"name: \")\n",
    "age = input(\"age: \")\n",
    "job = input(\"job: \")\n",
    "salary = input(\"salary: \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0a0ed5a7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-----INFO xinyi-----\n",
      "age：20 \n",
      "job：dd\n",
      "salary：200\n"
     ]
    }
   ],
   "source": [
    "#　注释来写内容存到字符串中\n",
    "#   知识点1： 字符串拼接 用 + 让打印的结果更直观\n",
    "info = '''-----INFO ''' + name + '''-----''' + '''\n",
    "age：''' + age + ''' \n",
    "job：''' + job + '''\n",
    "salary：''' + salary\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "ace6002f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "------INFO xinyi ------\n",
      "name:xinyi\n",
      "age:20\n",
      "job:dd\n",
      "salary:200 \n"
     ]
    }
   ],
   "source": [
    "# 知识点2： %s占位符，可以把 “+”符号 省略，比较直观的展示变量内容\n",
    "#       缺点： 如果变量很多，就比较麻烦了\n",
    "\n",
    "info = '''------INFO %s ------\n",
    "name:%s\n",
    "age:%s\n",
    "job:%s\n",
    "salary:%s '''%(name,name,age,job,salary)  # 因为要注意顺序不能错\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "75890467",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "------INFO xinyi ------\n",
      "name:xinyi\n",
      "age:20\n",
      "job:dd\n",
      "salary:200\n"
     ]
    }
   ],
   "source": [
    "# 知识点3: .format() 比起%s 更适合较多变量的打印，不需要考量顺序和出现次数\n",
    "#          例如 : url 的拼接 (https:// + 域名 + endpoint)\n",
    "info = '''------INFO {HTML_name} ------\n",
    "name:{HTML_name}\n",
    "age:{HTML_age}\n",
    "job:{HTML_job}\n",
    "salary:{HTML_salary}'''.format(HTML_age=age,HTML_job=job,HTML_name=name,HTML_salary=salary)\n",
    "print(info)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
